package designpattern.factorial;

import java.util.Scanner;

public class Application {
    public static void main(String[] args) {
        Scanner cin = new Scanner(System.in);
        int n = cin.nextInt();
        Handler handlers[] = {new IntHandler(), new LongHandler(), new BigIntegerHandler()};
        handlers[0].setNext(handlers[1]);
        handlers[1].setNext(handlers[2]);
        handlers[0].handleRequest(n);
    }
}
